/**
 * 
 */
package org.jenkon.comparator;

import java.util.Collection;
import java.util.Comparator;

/**
 * Compare two {@link Collection} of her size.
 * 
 * @author Jens Konopka
 * 
 * @param <T> the type of list entry
 */
public class SizeCollectionComparator<T> implements Comparator<Collection<T>> {

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	public int compare(final Collection<T> o1, final Collection<T> o2) {
		if (o1.size() > o2.size()) {
			return 1;
		} else if (o2.size() > o1.size()) {
			return -1;
		}
		return 0;
	}

}
